package com.credithc.customers.dataservice.service.impl;

import com.credithc.customers.base.constants.CustomerConstants;
import com.credithc.customers.dataservice.mapper.DLR.DlrMapper;
import com.credithc.customers.dataservice.po.ServiceSystemUserInfo;
import com.credithc.customers.dataservice.service.ServiceSystemUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class ServiceSystemUserServiceImpl implements ServiceSystemUserService {
    @Autowired
    private DlrMapper dlrMapper;

    @Override
    public List<ServiceSystemUserInfo> getDLRListByCustomerNo(List<String> customerNos) {
        if (customerNos.size()<1){
            return null;
        }
        List<ServiceSystemUserInfo> serviceSystemUserInfos = dlrMapper.queryCardInfoByUserIds(customerNos);
        for (ServiceSystemUserInfo s:serviceSystemUserInfos) {
            int cardType = s.getCardType();
            if (cardType == CustomerConstants.DLR_CARD_TYPR_ID_CARD){
                s.setCardType(CustomerConstants.CARD_TYPR_ID_CARD);
            }else{
                s.setCardType(null);
            }
        }
        return serviceSystemUserInfos;
    }
}
